<%@page pageEncoding="UTF-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
  String path =request.getContextPath();
%>
<html>
	<head>
		<title>用户组信息添加</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<base target="_self"/>
		<jsp:include page="../common/init.jsp"></jsp:include>
		<script type="text/javascript" src="<%=path%>/dwr/interface/YhzService.js"></script>
		<script type="text/javascript" src="<%=path%>/dwr/engine.js"></script>
		<script type="text/javascript" src="<%=path%>/dwr/util.js"></script>
		<script type="text/javascript">
		//提示信息
		function showMessage(){
			var message="<%=request.getAttribute("info")%>";
			if(message != "null" && message != ""){
				document.getElementById('errorDivCreateWzbm').innerHTML='提示信息:<span style="font-size:12px;color:#ff0000">' + message + '</span>';
				document.getElementById('errorDivCreateWzbm').style.display="inline";
				document.getElementById('errorDivCreateWzbm').focus();
			}
		}
		//用户组名验证
		function validateYhzm(ajaxFlag){
			var checkId="appsysYhz.yhzm";
			var checkValue=document.getElementById("appsysYhz.yhzm").value;
			var errorDivId="yhzmDiv";
			var errorImgId="yhzmImg";
			if(checkNullValue(checkValue)){
				showMenuDelegate(checkId,errorDivId,errorImgId,"用户组名不能为空!");
				return false;
			}
			else if (checkValue.length>30){
				showMenuDelegate(checkId,errorDivId,errorImgId,"用户组名长度不能超过30个字!");
				return false;
			}
			else if (ajaxFlag=='b'){	
			    //验证用户组名称是否重复	
			   DWREngine.setAsync(false);
			   var flag = false;
			   YhzService.checkName(checkValue,function(data){		     
				   if(data==true){		     
						showMenuDelegate(checkId,errorDivId,errorImgId,"该用户组名称已被用,请重新填写!");
						flag = false;
					}else{
					    flag =true;
				}
			   }); 	
			   DWREngine.setAsync(true);	
			   return flag;
			}
			else
			{
				hiddenErrorImg(errorImgId);
				return true;
			}
		}
		//功能描述长度
		function validateYhzms()
		{
			var checkId="appsysYhz.yhzms";
			var checkValue=document.getElementById("appsysYhz.yhzms").value;
			var errorDivId="yhzmsDiv";
			var errorImgId="yhzmsImg";
			if(checkValue.length>100)
			{
				showMenuDelegate(checkId,errorDivId,errorImgId,"功能描述不能超过100字!");
				return false;
			}else
			{
				hiddenErrorImg(errorImgId);
				return true;
			}
		}
		//提交;
		function doSubmit()
		{	
			if(validateYhzm('b')&&validateYhzms())
			{
				document.forms[0].action="createYhz.do";
				document.forms[0].submit();
			}
			else
			{
				return;
			}
		}
		
		//页面关闭
		function winClose()
		{
			window.returnValue = "ok";
			window.close();
		}
		//表单reset
		function formReset()
		{
			document.forms[0].reset();
		}
//生成功能按钮	
mpmenu1=new mMenu('','winClose()','script','<%=request.getContextPath() %>/images/img_ht_wz_44.gif','62','24','0','100','2');
</script>
</head>
<body onload="showMessage()">
<s:form action="">
<table cellspacing="0" cellpadding="0" class="main_tab1" onclick="javascript: mouseClick('errorDivCreateWzbm');">
    <tr>
        <td rowspan="4" class="main_tab1_td8">&nbsp;</td>
        <td class="main_tab1_td1"><img src="<%=request.getContextPath() %>/images/img_ht_wz_28.gif" alt="left" /></td>
        <td class="main_tab1_td2">
		<div id="location">用户组信息添加</div>
		<div id="funbut">
			<SCRIPT>document.write(mwritetodocument());</SCRIPT>
		</div>
		</td>
        <td class="main_tab1_td1"><img src="<%=request.getContextPath() %>/images/img_ht_wz_32.gif" alt="right" /></td>
    </tr>
    <tr>
        <td colspan="3" class="main_tab1_td3">
		<div id="mainbg">
		<div class="jiange10"></div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="main_tab3">
				<tr valign="bottom" height="30">
					<td height="35" colspan="2" align="left" valign="bottom"
						class="r_tab_c_4">
						<div id="errorDivCreateWzbm"></div>
					</td>
				</tr>
				<tr valign="bottom" align="center" height="30">
					<th>
						用户组名：
					</th>
					<td  align="left" valign="bottom" >
					<s:textfield name="appsysYhz.yhzm" id="appsysYhz.yhzm" size="20" maxLength="30"
						theme="simple" onclick="javascript: mouseClick('yhzmDiv')" 
								onfocus="this.style.borderColor='#68A6F5'" onblur="validateYhzm('a');" cssClass="inp_02">
					</s:textfield>
						 &nbsp;
				<img src="" id="yhzmImg" style="display:none;"/>
				<div id="yhzmDiv" style="background:#008080;display:none;cursor:default"/>
									&nbsp;
								<font color="#ff0000">*</font>
								<s:hidden name="appsysYhz.yhzlx" value="0"></s:hidden>
					</td>
					</tr>
				<tr valign="bottom" height="30">
					<th valign="middle">
						功能描述：
					</th>
					<td colspan="3" align="left" valign="bottom">
						<s:textarea id="appsysYhz.yhzms" name="appsysYhz.yhzms" cols="35" rows="6"
							theme="simple" onclick="javascript: mouseClick('yhzmsDiv')" 
								onfocus="this.style.borderColor='#68A6F5'" onblur="validateYhzms();" >
					</s:textarea>
						 &nbsp;
				<img src="" id="yhzmsImg" style="display:none;"/>
				<div id="yhzmsDiv" style="background:#008080;display:none;cursor:default"/>
					</td>
				</tr>
			</table>
<div class="butk">
<div class="btn_01">
<a href="javascript:doSubmit()">保&nbsp;存</a>
</div>
<div class="btn_01">
<a href="javascript:formReset()">清&nbsp;除</a>
</div>
</div>
</div>
</td>
    </tr>
    <tr>
        <td class="main_tab1_td4"><img src="<%=request.getContextPath() %>/images/img_ht_wz_65.gif" alt="left" /></td>
        <td class="main_tab1_td5"></td>
        <td class="main_tab1_td4"><img src="<%=request.getContextPath() %>/images/img_ht_wz_67.gif" alt="right" /></td>
    </tr>
    <tr>
        <td colspan="3" class="main_tab1_td7">&nbsp;</td>
    </tr>
</table>
</s:form>
</body>
</html>